
if ( typeof(controlElement.length) == "number" )
{
	controlElement = controlElement[0];
}

var argListDoc = GetTransformArgumentList(controlElement.id);
var pagingNode = argListDoc.selectSingleNode("//Paging");
var pageIndexNode = pagingNode.selectSingleNode("PageIndex");
var pageSizeNode = pagingNode.selectSingleNode("PageSize");
var pageCountNode = pagingNode.selectSingleNode("PageCount");

if (typeof(g_categoryItemCount) != "undefined")
{
	var documentSource
	=  GetKindPath(argListDoc.selectSingleNode("//Params/Kind").text)
		+ g_categoryVisualLevel + "CODE/" 
		+ GetFilterPath(argListDoc.selectSingleNode("//Params/Filter"))
		+ GetMotorsFilterPath(getQueryParam("filter", document.location.search))
		+ controlElement.sort
		+ "/DATA_" + g_categoryID + "_" +(Math.floor(parseInt(pageIndexNode.text)/10)+1) + ".XML";
	
	document.write("<!--product file path:"+documentSource+"-->");
	var xmlDocument = new ActiveXObject( "Msxml2.DOMDocument.3.0" );
	xmlDocument.async = false;
	xmlDocument.load( documentSource );
	xmlDocument.setProperty("SelectionNamespaces", 
	'xmlns:my="http://schema.auction.co.kr/Arche.Stores.xsd" ');

	pageCountNode.text =  parseInt((Number(g_categoryItemCount) + Number(pageSizeNode.text) -1) /pageSizeNode.text);
	
	var startPageIndexNode = pagingNode.selectSingleNode("StartPageIndex");
	var startDataIndexNode = pagingNode.selectSingleNode("StartDataIndex");
	
	startPageIndexNode.text = Math.floor(parseInt(pageIndexNode.text)/10) * 10 +1;
	startDataIndexNode.text = Math.floor(parseInt(pageIndexNode.text)/10) * Number(pageSizeNode.text) * 10;
	
	if (typeof(g_categoryAttrib) != "undefined")
	{
		/*
		var ArgumentNodes = argListDoc.selectNodes("/ArrayOfXsltArgument/XsltArgument");
	
		for(i = 0; i < ArgumentNodes.length;i++){
			var xmlNode = ArgumentNodes[i];
			
			if(xmlNode.getAttribute("Name") == "AttributeType"){
				xmlNode.selectSingleNode("Parameter").text = g_categoryAttrib
				break;
			}
		}*/
		
		var rootNode = argListDoc.selectSingleNode("/ArrayOfXsltArgument");
		var argumentNode = argListDoc.createElement("XsltArgument");
		rootNode.appendChild(argumentNode);
		argumentNode.setAttribute("Name","AttributeType")
	    
		var parameterNode = argListDoc.createElement("Parameter");
		parameterNode.text = g_categoryAttrib;
		argumentNode.appendChild(parameterNode);
    		
	}
	controlElement.xmlDocument = xmlDocument;	
}
//else
//{
//    debugger;
//    if (controlElement.documentSource = "/aspnet_client/Arche_Web_UI_WebControls_1_1_0_0/ProductListSampleData.xml")
//		pageCountNode.text = "0";	
//}
	


function GetKindPath(kindChar)
{
	if (typeof(g_CornerPath)!="undefined")
		return g_CornerPath +"/" ;		
	if (kindChar=="N")
		return strStItem + "/NORMAL/";
	else if (kindChar=="F")
		return strStItem + "/FIXEDPRICE/";
	else if (kindChar=="C")
		return strStItem + "/GROUPBUYING/";
	else
		return strStItem + "/ALL/"; 
}

function GetFilterPath(filterNode)
{
	if (getQueryParam("displaytype", document.location.search)=="PHOTO")
		return "PHOTO/";
	if (filterNode != null && filterNode.text.length>0)
		return filterNode.text + "/";
	else
		return "";
}

function GetMotorsFilterPath(filterStr)
{
	if (filterStr.length>0)
	{
		if (filterStr == "G")
			return "GT/";
		else if (filterStr == "E")
			return "EX/";
		else if (filterStr == "A")
			return "GTEX/";
		else
			return "";
	}
	else
		return "";
}

